<?php
// +----------------------------------------------------------------------
// | SparkERP 优秀的进销存系统
// +----------------------------------------------------------------------
// | Copyright (c) 2022~2099 http://erp.sparkshop.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: NickBai  <1902822973@qq.com>
// +----------------------------------------------------------------------
namespace app\controller\setting;

use app\controller\Base;
use app\service\setting\RoleService;

class Role extends Base
{
    /**
     * 获取列表
     */
    public function index(RoleService $service)
    {
        return json($service->getList(input('param.')));
    }

    /**
     * 添加
     */
    public function add(RoleService $service)
    {
        if (request()->isPost()) {

            return json($service->addRole(input('post.')));
        }
    }

    /**
     * 编辑
     */
    public function edit(RoleService $service)
    {
        if (request()->isPost()) {

            return json($service->editRole(input('post.')));
        }
    }

    /**
     * 删除
     */
    public function del(RoleService $service)
    {
        return json($service->delRole(input('param.id')));
    }
}
